package com.ruoyi.lab.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.lab.domain.JacLabSupplyFile;
import com.ruoyi.lab.service.IJacLabSupplyFileService;
import com.ruoyi.lab.utils.MyTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * SupplyFile 提供者
 * 
 * @author ruoyi
 * @date 2021-05-06
 */
@RestController
@RequestMapping("supplyfile")
public class JacLabSupplyFileController extends MyTool
{
	
	@Autowired
	private IJacLabSupplyFileService jacLabSupplyFileService;
	
	/**
	 * 查询${tableComment}
	 */
	/*@GetMapping("get/{id}")
	public Map<String, Object> get(@PathVariable("id") Long id)
	{
		startPage();
		Map<String, Object> result = new HashMap<>(jacResultMsg("1"));
		result.put("data", jacLabSupplyFileService.selectJacLabSupplyFileById(id));
		return result;
	}*/
	
	/**
	 * 查询SupplyFile列表
	 */
	@GetMapping("list")
	public R list(JacLabSupplyFile jacLabSupplyFile)
	{
        return result(jacLabSupplyFileService.selectJacLabSupplyFileList(jacLabSupplyFile));
	}
	
	
	/**
	 * 新增保存SupplyFile
	 */
	@PostMapping("save")
	public Map<String, String> addSave(@RequestBody JacLabSupplyFile jacLabSupplyFile)
	{		
		return jacResultMsg(jacLabSupplyFileService.insertJacLabSupplyFile(jacLabSupplyFile));
	}

	/**
	 * 修改保存SupplyFile
	 */
	@PostMapping("update")
	public Map<String, String> editSave(@RequestBody JacLabSupplyFile jacLabSupplyFile)
	{		
		return jacResultMsg(jacLabSupplyFileService.updateJacLabSupplyFile(jacLabSupplyFile));
	}

	/**
	 * 修改保存供应商可见状态
	 */
	@PostMapping("updatepower")
	public Map<String, String> updatepower(@RequestBody JacLabSupplyFile jacLabSupplyFile)
	{
		return jacResultMsg(jacLabSupplyFileService.updateJacLabSupplyFilePower(jacLabSupplyFile));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public Map<String, String> remove(String ids)
	{		
		return jacResultMsg(jacLabSupplyFileService.deleteJacLabSupplyFileByIds(ids));
	}

	/**
	 * 删除单个文件${tableComment}
	 */
	@PostMapping("removefile")
	public Map<String, String> removefile(String fileId)
	{
		return jacResultMsg(jacLabSupplyFileService.deleteJacLabSupplyFileById(fileId));
	}
	
}
